package com.nervenets.web.controller;

import com.nervenets.utils.AESUtils;
import com.nervenets.web.entity.GetAesParams;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;

/**
 * 中转跳转，每个分享页面的入口
 * Created by Joe on 2018/3/7.
 */
@RequestMapping("/r")
@Controller
public class RedirectController extends BaseController {

    @RequestMapping(value = "/{hex}", method = RequestMethod.GET)
    protected String r(HttpServletRequest request, @PathVariable String hex) {
        GetAesParams params = new GetAesParams();
        try {
            String json = AESUtils.decryptData(hex);
            params = new GetAesParams(json);
        } catch (Exception e) {
            //
        }
        switch (params.getT()) {
            case def:
                break;
            case rd:
                break;
        }
        //读取广告

        return "views/stc/api1doc";
    }
}
